package pl.edu.mimuw.irs.rcp.controller.editor.requirements;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;

import pl.edu.mimuw.irs.core.model.design.net.IRSRequirement;
import pl.edu.mimuw.irs.core.model.design.resource.Roles;

public class RequirementsEditorInput implements IEditorInput {

	public static final String NAME = "Requirements Editor Input";
	
	// *** Attributes

	private final IRSRequirement requirement;
	public IRSRequirement getRequirement() {
		return requirement;
	}
	private final Roles rolesMap;
	public Roles getRolesMap() {
		return rolesMap;
	}
	
	// *** Constructors
	
	public RequirementsEditorInput(IRSRequirement requirement,
			Roles rolesMap) {
		this.requirement = requirement;
		this.rolesMap = rolesMap;
	}
	
	// *** Methods

	@Override
	public boolean exists() {
		return false;
	}

	@Override
	public ImageDescriptor getImageDescriptor() {
		return null;
	}

	@Override
	public String getName() {
		return NAME;
	}

	@Override
	public IPersistableElement getPersistable() {
		return null;
	}

	@Override
	public String getToolTipText() {
		return NAME;
	}

	@SuppressWarnings("unchecked")
	@Override
	public Object getAdapter(Class adapter) {
		// XXX Auto-generated method stub
		return null;
	}

	@Override
	public boolean equals(Object obj) {
		if (super.equals(obj)) {
			return true;
		}
		if (obj instanceof RequirementsEditorInput) {
			return requirement.equals(((RequirementsEditorInput)obj).getRequirement());
		}
		return false;
	}

	@Override
	public int hashCode() {
		return requirement.hashCode();
	}
}
